<!DOCTYPE html>
<html>
{include file="head.html"}
<body>
<div class="body">
{include file="header.html"}
<div class="main-body box960">
<div class="row">
<div class="col-6-1">{include file='user_left.html'}</div>
<div class="col-6-5">
<ul class="sale-tab-sub">
    <li id="tab1" class="sale-sub-menu selected"><a href="{$appshop}?m=shop_flash">轮显管理</a></li>
</ul>
<!--<ul class="nav nav-tabs">
<li {if get('a') eq 'default'}class="active"{/if}><a href="{$appshop}?m=shop_flash">轮显管理</a></li>
 
</ul>
-->
<style>
.btn-upload{float:right;}
</style>
<div  style="padding:20px 30px 0px;">备注：网址--该产品详细页网址 。 图片大小：720x300.</div>
<div style="margin:0px 30px"><table class="h_list" width="100%" cellspacing="0" cellpadding="0">
	<thead>
  <tr>
     <td>排序</td>
   <td>图片描述</td>
   <td>网址</td>
   <td width="200">图片</td>
   
  
    
<td>操作</td>
  </tr>
  </thead>
 {foreach item=c key=k from=$data}
<form method='post' action='shopadmin.php?m=shop_flash&a=save'>
<tbody id="houseTable">
<tr>
   <td>{$k+1}</td>
   <td><input type="hidden" name="id" value="{$c.id}"> <input type="text" name="title" value="{$c.title}" class="w200"></td>
  
   <td><input type="text" name="linkurl" value="{$c.linkurl}"></td>
    <td>
   <span id="imgShow{$c.id}">
      {if $c.imgurl}
      <img src="/{$c.imgurl}.100x100.jpg" width="50">
      {/if}
      </span>
   <div class="btn-upload">
      <input type="file" name="upimg" class="btn-upload-file" id="upimg{$c.id}" onChange="uploadgoodsimg({$c.id})">
      </div>
      <label  id="loading" style="color:red; display:none;">正在上传中...</label>
      <input type="hidden" name="imgurl" id="imgurl{$c.id}" value="{$c.imgurl}">
      </td>
    
<td><button type="submit" class="btn btn-primary">保存</button></td>
  </tr>
  </tbody>
  </form>
  
   {/foreach}
 
   <div>
<form method='post' action='shopadmin.php?m=shop_flash&a=save'>
<tbody id="houseTable">	 
    <tr>
  <td>排序 <input type="text" name="orderindex" class="w100"></td>
   <td>图片描述 <input type="text"  name="title" class="w200"></td>
   
   <td>网址 <input type="text" name="linkurl" class="w200" value="" placeholder="该产品详细页网址"></td>
   
    <td ><div class="btn-upload">
      <input type="file" name="upimg" class="btn-upload-file" id="upimgd{$cc}" onChange="uploadgoodsimg('d{$cc}')">
      </div>
      <label  id="loading" style="color:red; display:none;">正在上传中...</label>
      <input type="hidden" name="imgurl" id="imgurld{$cc}" value="">
      <span id="imgShowd{$cc}">

      </span></td>
<td><button type="submit" class="btn btn-success">保存</button></td>
  </tr>
   
  </tbody>  
    
    </form>
</div>
 
 </table>
 </div>
<div>{$pagelist}</div>
</div>
</div>
</div>

<script language="javascript" src="/plugin/jquery/ajaxfileupload.js"></script>
<script language="javascript">
   function uploadgoodsimg(key)
    {
		var fileid="upimg"+key;
		var imgurl=$("#imgurl"+key);
		var imgShow=$("#imgShow"+key);
        $.ajaxFileUpload
        (
            {
                url:'/index.php?m=upload&a=uploadtao&dir=shop_flash&t='+Math.random(), 
                secureuri:false,
                fileElementId:fileid,
                dataType: 'json',
                success: function (data, status)
                {
                    if(typeof(data.error) != 'undefined')
                    {
                        if(data.error != '')
                        {
                           alert(data.msg);
                        }else
                        {
							imgShow.html("<img src='/"+data.imgurl+".100x100.jpg' width='50'>");
							 imgurl.val(data.imgurl);
                        }
                    }
                },
                error: function (data, status, e)
                {
					alert(data.msg)
  
                }
            }
        )
        
        return false;

    }
</script>
{include file="footer.html"}